layui.use(['table','func'], function(){
    var $ = layui.jquery;
    var table = layui.table;
    var laydate = layui.laydate;
    var form = layui.form;
    var func = layui.func;



    /**
     * 管理
     */
    var AssignmentShow = {
        tableId: "assignmentShow"
    };

    /**
     * 初始化表格的列
     */
    AssignmentShow.initColumn = function () {
        return [[
            {type: 'checkbox'},
            {field: 'id', hide: true, title: ''},
            {field: 'userName', sort: true, title: '用户名'},
            {field: 'countVideo', sort: true, title: '已完成视频量'},
            {field: 'mondyVideo', sort: true, title: '本周完成视频量'},
            {align: 'center', toolbar: '#tableBar', minWidth: 310,title: '操作'},
        ]];
    };

// 渲染表格
    var tableResult = table.render({
        elem: '#' + AssignmentShow.tableId,
        url: '/show/list',
        page: true,
        height: "full-158",
        cellMinWidth: 100,
        cols: AssignmentShow.initColumn()
    });

    /**
     * 跳转到查看详情页面
     */
    AssignmentShow.detail = function (data) {
        func.open({
            height: 650,
            title: '查看任务详情',
            content: '/task/detail?id=' + data.id,
            tableId: AssignmentShow.tableId
        });
    };
    // 工具条点击事件
    table.on('tool(' + AssignmentShow.tableId + ')', function (obj) {
        var data = obj.data;
        var layEvent = obj.event;

      if(layEvent == "detail"){
            AssignmentShow.detail(data);
        }

    });


});